package hczc.longcai.com.hccrowdfunding.search;


import android.os.Bundle;
import android.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.SimpleAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.fourth_mine.beans.Address;

/**
 * A simple {@link Fragment} subclass.
 */
public class HotSearchFragment extends Fragment implements AdapterView.OnItemClickListener {

    private static final String TAG = "HotSearchFragment";
    private String[] data = {"公益", "科技", "原创", "智能", "公益", "科技", "原创"};

    private GridView gridView;
    private HotSearchAdapter adapter;


    public HotSearchFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_hot_search, container, false);
        BaseApplication.scaleScreenHelper.loadView(((ViewGroup) view));

        initViews(view);


        return view;
    }


    private void initViews(View view) {

        gridView = ((GridView) view.findViewById(R.id.hot_search_details));
        adapter = new HotSearchAdapter(getActivity(),data);
        gridView.setAdapter(adapter);
        gridView.setSelector(R.color.touming);
        gridView.setOnItemClickListener(this);

    }


    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Log.d(TAG,"点击了"+data[position]+"选项");
    }
}
